package cn.iocoder.yudao.module.custom.dal.mysql.county;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.custom.dal.dataobject.county.CountyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.custom.controller.admin.county.vo.*;

/**
 * 区县信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CountyMapper extends BaseMapperX<CountyDO> {

    default PageResult<CountyDO> selectPage(CountyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CountyDO>()
                .likeIfPresent(CountyDO::getName, reqVO.getName())
                .eqIfPresent(CountyDO::getParentId, reqVO.getParentId())
                .orderByDesc(CountyDO::getId));
    }

    default List<CountyDO> selectList(CountyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CountyDO>()
                .likeIfPresent(CountyDO::getName, reqVO.getName())
                .eqIfPresent(CountyDO::getParentId, reqVO.getParentId())
                .orderByDesc(CountyDO::getId));
    }

    List<CountyDO> getCountyLists(Integer parentId);
}
